#include "runnable.h"
#include "thread_pool.h"
#include "exception.h"
#include <stdint.h>
#include "work_thread.h"

#define DEBUG

using namespace CThread;

class MyRunner : public Runnable
{
	void run(void* thread_self)
	{
		printf("hello\n");
		//sleep(3);
	}
};

int main()
{
	uint32_t aa = 0;
	//MyRunner* pRunner = new MyRunner();
	uint32_t thread=3, task=5;
	WorkThreadFactory* pThreadFactory = new WorkThreadFactory();
	ThreadPool pool(pThreadFactory, thread, task);
	pool.start();
	printf("ready to add task\n");
	for ( int i=0; i<10; i++ )
	{
		MyRunner* pRunner = new MyRunner();
		printf("add task %d\n", i);
		pool.add(pRunner);	
	}
	printf("add task finished\n");
	//pool.add(pRunner,1);
	//pool.stop();
	//sleep(10);
	return 0;
}
